<ol class="breadcrumb">
	<li><a href="/">Home</a></li>
	<li><a href="<?php echo $this->url(array('module' => 'default', 'controller' => 'candidatos', 'eleicao' => $this->candidato->getEleicao_id()->getAno()), null, true); ?>"><?php echo $this->candidato->getEleicao_id()->getDescricao(); ?></a></li>
	<li class="active">Debates</li>
</ol>

<nav class="navbar navbar-default" role="navigation">
	<div class="container-fluid">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-2">
				<span class="sr-only">Toggle navigation</span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
			</button>
		</div>
		<div class="collapse navbar-collapse navbar-search" id="bs-example-navbar-collapse-2">
			<div class="row">
				<form method="post" class="navbar-form" role="search">
					<div class="row">
						<div class="col-lg-8">
							<div class="row">
								<button type="button" class="btn btn-success" onclick="document.location.href='<?php echo $this->baseUrl('debates/add/candidato/' . $this->candidato->getId()); ?>'">novo debate</button>
							</div>
						</div>
						<div class="col-lg-4 pull-right">
							<div class="row">
								<div class="input-group">
									<?php echo $this->form->filtro_busca; ?>
									<span class="input-group-btn">
										<button class="btn btn-success" type="submit">
											<span class="glyphicon glyphicon-search"></span>
										</button>
									</span>
								</div>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</nav>

<?php if(count($this->messages) > 0) : ?>
<div class="alert alert-success"><?php echo current($this->messages[0]); ?></div>
<?php endif; ?>

<div class="panel panel-default">
	<div class="panel-heading">
		<?php echo $this->candidato->getCargo_id()->getDescricao(); ?> / <?php echo $this->candidato->getEstado_id() ? $this->candidato->getEstado_id()->getNome() : ($this->candidato->getCidade_id() ? ($this->candidato->getCidade_id()->getNome() . ' - ' . $this->candidato->getCidade_id()->getEstado_id()->getSigla()) : 'BR'); ?> / <?php echo $this->candidato->getPartido_id()->getSigla(); ?>
	</div>
	<div class="panel-body">
		<div class="media">
			<?php if (!is_null($this->candidato->getFoto())): ?>
			<div class="pull-left" href="#">
				<img class="media-object" src="<?php echo $this->baseUrl('fotos/' . $this->candidato->getFoto()); ?>" alt="<?php echo $this->candidato->getNome(); ?>">
			</div>
			<?php endif; ?>
			<div class="media-body">
				<h4 class="media-heading"><?php echo $this->candidato->getNome(); ?> - <?php echo $this->candidato->getNumero(); ?></h4>
				<p><small><?php echo $this->candidato->getSituacao_id()->getDescricao(); ?> / <?php echo $this->candidato->getResultado_id()->getDescricao(); ?></small></p>
			</div>
		</div>
	</div>
</div>

<?php foreach ($this->debates as $debate): ?>
<div class="panel panel-default">
	<div class="panel-body">
		<div class="media">
			<a class="pull-left" href="#">
				<img class="img-circle" src="<?php echo $this->baseUrl('assets/img/user-48x48.png'); ?>" alt="FOTO_USUARIO">
			</a>
			<div class="media-body">
				<h4 class="media-heading"><?php echo $debate['titulo']; ?></h4>
				<p><?php echo $debate['descricao']; ?></p>
				<p>
					<a href="<?php echo $this->url(array('module' => 'default', 'controller' => 'debates', 'action' => 'discuss', 'debate' => $debate['id']), null, true); ?>" role="button">Debater »</a>
				</p>
			</div>
		</div>
	</div>
</div>
<?php endforeach; ?>

<?php echo $this->paginationControl($this->debates, 'Sliding', 'paginator.phtml'); ?>